﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Transformer.iHunter.UI
{
    public partial class TaskListWindow : Form
    {
        public TaskListWindow()
        {
            InitializeComponent();
        }

        public TaskRunner TaskRunner{ get; set; }

        public void RefreshTaskList()
        {
            if (TaskRunner == null)
                return;
            this.listBox1.Items.Clear();
            this.listBox1.Items.AddRange(TaskRunner.GetTaskInfos());
        }

        private void buttonCancelAll_Click(object sender, EventArgs e)
        {
            if (TaskRunner == null)
                return;
            TaskRunner.CancelAll();
            RefreshTaskList();
        }

        private void TaskListWindow_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (e.CloseReason == CloseReason.UserClosing)
            {
                Hide();
                e.Cancel = true;
            }
        }

        private void TaskListWindow_Load(object sender, EventArgs e)
        {

        }
    }
}
